<template>
	<view>
		<u--form labelPosition="top" labelWidth="200" :model="form" :rules="rules" ref="uForm">
			<view class="form-area">
				<view style="margin: 20rpx 0;" class="info-title">项目在批情况</view>
				<u-form-item label="项目代码:" prop="projectApprove.projectDm">
					<u--input placeholder="请输入项目代码" maxlength="30" v-model="form.projectApprove.projectDm"></u--input>
				</u-form-item>
				<u-form-item label="备案投资额:" prop="projectApprove.recordedInvestmentAmount">
					<u--input type="digit" placeholder="请输入备案投资额" maxlength="10"
						v-model="form.projectApprove.recordedInvestmentAmount">
						<template slot="suffix">万元</template>
					</u--input>
				</u-form-item>
				<u-form-item label="当年计划投资:" prop="projectApprove.currentYearPlannedInvestment">
					<u--input type="digit" placeholder="请输入当年计划投资" maxlength="10"
						v-model="form.projectApprove.currentYearPlannedInvestment">
						<template slot="suffix">万元</template>
					</u--input>
				</u-form-item>
				<u-form-item required label="计划开工日期:" prop="projectApprove.plannedStartDate">
					<view style="width: 100%;" @click="openDate(1)">
						<u--input disabled disabledColor="#ffffff" style="pointer-events: none;" placeholder="请选择计划开工日期"
							v-model="form.projectApprove.plannedStartDate" suffixIcon="calendar"
							suffixIconStyle="color: #909399"></u--input>
					</view>
				</u-form-item>
				<u-form-item label="供地时间:" prop="projectApprove.landSupplyDate">
					<view style="width: 100%;" @click="openDate(2)">
						<u--input disabled disabledColor="#ffffff" style="pointer-events: none;"
							placeholder="请选择供地时间(拿地后填)" v-model="form.projectApprove.landSupplyDate"
							suffixIcon="calendar" suffixIconStyle="color: #909399"></u--input>
					</view>
				</u-form-item>
				<u-form-item label="供地面积:" prop="projectApprove.landSupplyArea">
					<u--input type="digit" placeholder="请输入供地面积(拿地后填)" maxlength="10"
						v-model="form.projectApprove.landSupplyArea">
						<template slot="suffix">m²</template>
					</u--input>
				</u-form-item>
				<u-form-item label="所属街道:" prop="projectInfo.street">
					<u--input placeholder="请输入所属街道(拿地后填)" maxlength="50"
						v-model="form.projectApprove.street"></u--input>
				</u-form-item>
				<u-form-item label="用地位置:" prop="projectInfo.landLocationSecond">
					<u--input placeholder="请输入用地位置(拿地后填)" maxlength="100"
						v-model="form.projectApprove.landLocationSecond"></u--input>
				</u-form-item>
				<u-form-item label="土地合同约定开工时间:" prop="projectApprove.agreedStart">
					<view style="width: 100%;" @click="openDate(3)">
						<u--input disabled disabledColor="#ffffff" style="pointer-events: none;" placeholder="拿地后填"
							v-model="form.projectApprove.agreedStart" suffixIcon="calendar"
							suffixIconStyle="color: #909399"></u--input>
					</view>
				</u-form-item>
				<u-form-item label="土地合同约定竣工时间:" prop="projectApprove.agreedCompletion">
					<view style="width: 100%;" @click="openDate(4)">
						<u--input disabled disabledColor="#ffffff" style="pointer-events: none;" placeholder="拿地后填"
							v-model="form.projectApprove.agreedCompletion" suffixIcon="calendar"
							suffixIconStyle="color: #909399"></u--input>
					</view>
				</u-form-item>
				<u-form-item label="监管协议约定达产时间:" prop="projectApprove.agreedProduction">
					<view style="width: 100%;" @click="openDate(5)">
						<u--input disabled disabledColor="#ffffff" style="pointer-events: none;"
							placeholder="请选择监管协议约定达产时间" v-model="form.projectApprove.agreedProduction"
							suffixIcon="calendar" suffixIconStyle="color: #909399"></u--input>
					</view>
				</u-form-item>
				<u-form-item label="列省市重大项目时间:" prop="projectApprove.majorProjectDate">
					<view style="width: 100%;" @click="openDate(6)">
						<u--input disabled disabledColor="#ffffff" style="pointer-events: none;"
							placeholder="请选择列省市重大项目时间" v-model="form.projectApprove.majorProjectDate"
							suffixIcon="calendar" suffixIconStyle="color: #909399"></u--input>
					</view>
				</u-form-item>
				<u-form-item required label="省市重大项目:" prop="projectApprove.projectProvince">
					<u-radio-group style="margin-top: 30rpx;" v-model="form.projectApprove.projectProvince">
						<u-radio shape="circle" :name="1" label="省重大"></u-radio>
						<u-radio style="margin: 0 20rpx;" shape="circle" :name="2" label="市重大"></u-radio>
						<u-radio shape="circle" :name="3" label="否"></u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item label="总平图:" prop="projectApprove.generalPlanDiagram">
					<u-radio-group style="margin-top: 30rpx;" v-model="form.projectApprove.generalPlanDiagram">
						<u-radio shape="circle" :name="1" label="未办理"></u-radio>
						<u-radio style="margin: 0 20rpx;" shape="circle" :name="2" label="正在办理"></u-radio>
						<u-radio shape="circle" :name="3" label="已批"></u-radio>
					</u-radio-group>
				</u-form-item>
				<u-form-item label="规划建筑面积:" prop="projectApprove.plannedConstructionArea">
					<u--input type="digit" placeholder="请输入规划建筑面积" maxlength="10"
						v-model="form.projectApprove.plannedConstructionArea">
						<template slot="suffix">m²</template>
					</u--input>
				</u-form-item>
				<u-form-item label="第一张施工许可证日期:" prop="projectApprove.firstPermitDate">
					<view style="width: 100%;" @click="openDate(7)">
						<u--input disabled disabledColor="#ffffff" style="pointer-events: none;"
							placeholder="请选择第一张施工许可证日期" v-model="form.projectApprove.firstPermitDate"
							suffixIcon="calendar" suffixIconStyle="color: #909399"></u--input>
					</view>
				</u-form-item>
				<u-form-item label="承诺制开工日期:" prop="projectApprove.promisedStartDate">
					<view style="width: 100%;" @click="openDate(8)">
						<u--input disabled disabledColor="#ffffff" style="pointer-events: none;"
							placeholder="请选择承诺制开工日期" v-model="form.projectApprove.promisedStartDate"
							suffixIcon="calendar" suffixIconStyle="color: #909399"></u--input>
					</view>
				</u-form-item>
				<u-form-item label="开工面积:" prop="projectApprove.commencedArea">
					<u--input type="digit" placeholder="施工许可证载面积累加" maxlength="10"
						v-model="form.projectApprove.commencedArea">
						<template slot="suffix">m²</template>
					</u--input>
				</u-form-item>
				<u-form-item required label="实际开工日期:" prop="projectApprove.actualStartDate">
					<view style="width: 100%;" @click="openDate(9)">
						<u--input disabled disabledColor="#ffffff" style="pointer-events: none;"
							placeholder="以承诺制开工日期或第一张施工许可发放日期最先为准，技改项目手工输入"
							v-model="form.projectApprove.actualStartDate" suffixIcon="calendar"
							suffixIconStyle="color: #909399"></u--input>
					</view>
				</u-form-item>
				<u-form-item required label="项目前期工作开展情况:" prop="projectApprove.preWork">
					<u--textarea :height="150" v-model="form.projectApprove.preWork" maxlength="500" count
						placeholder="请输入项目前期工作开展情况"></u--textarea>
				</u-form-item>
				<view style="font-weight: bold;">五评</view>
				<u-form-item required label="职评批示状态:" prop="projectApprove.evaluationApprovalStatus">
					<uni-data-select :clear="false" v-model="form.projectApprove.evaluationApprovalStatus"
						:localdata="statusList"></uni-data-select>
				</u-form-item>
				<u-form-item v-if="form.projectApprove.evaluationApprovalStatus==0" label="职评附件:">
					<filePicker :fileExtname='["pdf", "png", "jpg", "zip", "rar", "doc", "docx", "xls", "xlsx"]'
						v-model="form.projectApprove.evaluationApprovalArr"
						@select="selectFile($event,'evaluationApproval')"
						@delete="deleteFile($event,'evaluationApproval')" limit="3" file-mediatype="all">
					</filePicker>
				</u-form-item>
				<u-form-item required label="稳评批示状态:" prop="projectApprove.stabilityEvaluationApprovalStatus">
					<uni-data-select :clear="false" v-model="form.projectApprove.stabilityEvaluationApprovalStatus"
						:localdata="statusList"></uni-data-select>
				</u-form-item>
				<u-form-item v-if="form.projectApprove.stabilityEvaluationApprovalStatus==0" label="稳评附件:">
					<filePicker :fileExtname='["pdf", "png", "jpg", "zip", "rar", "doc", "docx", "xls", "xlsx"]'
						v-model="form.projectApprove.stabilityEvaluationApprovalArr"
						@select="selectFile($event,'stabilityEvaluationApproval')"
						@delete="deleteFile($event,'stabilityEvaluationApproval')" limit="3" file-mediatype="all">
					</filePicker>
				</u-form-item>
				<u-form-item required label="环评批示状态:" prop="projectApprove.assessmentApprovalStatus">
					<uni-data-select :clear="false" v-model="form.projectApprove.assessmentApprovalStatus"
						:localdata="statusList"></uni-data-select>
				</u-form-item>
				<view
					v-if="form.projectApprove.assessmentApprovalStatus==0||form.projectApprove.assessmentApprovalStatus==2">
					<u-form-item label="环评批示类型:">
						<uni-data-select :clear="false" v-model="form.projectApprove.assessmentApprovalType"
							:localdata="hppslxList"></uni-data-select>
					</u-form-item>
					<u-form-item label="环评附件:">
						<filePicker :fileExtname='["pdf", "png", "jpg", "zip", "rar", "doc", "docx", "xls", "xlsx"]'
							v-model="form.projectApprove.assessmentApprovalArr"
							@select="selectFile($event,'assessmentApproval')"
							@delete="deleteFile($event,'assessmentApproval')" limit="3" file-mediatype="all">
						</filePicker>
					</u-form-item>
				</view>
				<u-form-item required label="安评批示状态:" prop="projectApprove.safetyApprovalStatus">
					<uni-data-select :clear="false" v-model="form.projectApprove.safetyApprovalStatus"
						:localdata="statusList"></uni-data-select>
				</u-form-item>
				<view v-if="form.projectApprove.safetyApprovalStatus==0||form.projectApprove.safetyApprovalStatus==2">
					<u-form-item label="安评批示类型:">
						<uni-data-select :clear="false" v-model="form.projectApprove.safetyApprovalType"
							:localdata="appslxList"></uni-data-select>
					</u-form-item>
					<u-form-item label="安评附件:">
						<filePicker :fileExtname='["pdf", "png", "jpg", "zip", "rar", "doc", "docx", "xls", "xlsx"]'
							v-model="form.projectApprove.safetyApprovalArr"
							@select="selectFile($event,'safetyApproval')" @delete="deleteFile($event,'safetyApproval')"
							limit="3" file-mediatype="all">
						</filePicker>
					</u-form-item>
				</view>
				<u-form-item required label="能评批示状态:" prop="projectApprove.energyApprovalStatus">
					<uni-data-select :clear="false" v-model="form.projectApprove.energyApprovalStatus"
						:localdata="statusList"></uni-data-select>
				</u-form-item>
				<view v-if="form.projectApprove.energyApprovalStatus==0||form.projectApprove.energyApprovalStatus==2">
					<u-form-item label="能评批示类型:">
						<uni-data-select :clear="false" v-model="form.projectApprove.energyApprovalType"
							:localdata="nppslxList"></uni-data-select>
					</u-form-item>
					<u-form-item label="能评附件:">
						<filePicker :fileExtname='["pdf", "png", "jpg", "zip", "rar", "doc", "docx", "xls", "xlsx"]'
							v-model="form.projectApprove.energyApprovalArr"
							@select="selectFile($event,'energyApproval')" @delete="deleteFile($event,'energyApproval')"
							limit="3" file-mediatype="all">
						</filePicker>
					</u-form-item>
				</view>
				<view style="font-weight: bold;">六证</view>
				<u-form-item required label="备案证状态:" prop="projectApprove.recordCertificateStatus">
					<uni-data-select :clear="false" v-model="form.projectApprove.recordCertificateStatus"
						:localdata="statusList"></uni-data-select>
				</u-form-item>
				<view v-if="form.projectApprove.recordCertificateStatus==0">
					<u-form-item label="备案证号:">
						<uni-easyinput :clearSize="16" :maxlength="50" type="text" :inputBorder="true"
							v-model="form.projectApprove.recordCertificateCode" placeholder="请输入备案证号"></uni-easyinput>
					</u-form-item>
					<u-form-item label="备案证附件:">
						<filePicker :fileExtname='["pdf", "png", "jpg", "zip", "rar", "doc", "docx", "xls", "xlsx"]'
							v-model="form.projectApprove.recordCertificateArr"
							@select="selectFile($event,'recordCertificate')"
							@delete="deleteFile($event,'recordCertificate')" limit="3" file-mediatype="all">
						</filePicker>
					</u-form-item>
				</view>
				<u-form-item required label="不动产权证状态:" prop="projectApprove.ownershipCertificateStatus">
					<uni-data-select :clear="false" v-model="form.projectApprove.ownershipCertificateStatus"
						:localdata="statusList"></uni-data-select>
				</u-form-item>
				<view v-if="form.projectApprove.ownershipCertificateStatus==0">
					<u-form-item label="不动产权证号:">
						<uni-easyinput :clearSize="16" :maxlength="50" type="text" :inputBorder="true"
							v-model="form.projectApprove.ownershipCertificateCode"
							placeholder="请输入不动产权证号"></uni-easyinput>
					</u-form-item>
					<u-form-item label="不动产权证附件:">
						<filePicker :fileExtname='["pdf", "png", "jpg", "zip", "rar", "doc", "docx", "xls", "xlsx"]'
							v-model="form.projectApprove.ownershipCertificateArr"
							@select="selectFile($event,'ownershipCertificate')"
							@delete="deleteFile($event,'ownershipCertificate')" limit="3" file-mediatype="all">
						</filePicker>
					</u-form-item>
				</view>
				<u-form-item required label="用地规划许可证状态:" prop="projectApprove.landPlanningPermitStatus">
					<uni-data-select :clear="false" v-model="form.projectApprove.landPlanningPermitStatus"
						:localdata="statusList"></uni-data-select>
				</u-form-item>
				<view v-if="form.projectApprove.landPlanningPermitStatus==0">
					<u-form-item label="用地规划许可证号:">
						<uni-easyinput :clearSize="16" :maxlength="50" type="text" :inputBorder="true"
							v-model="form.projectApprove.landPlanningPermitCode"
							placeholder="请输入用地规划许可证号"></uni-easyinput>
					</u-form-item>
					<u-form-item label="用地规划许可证附件:">
						<filePicker :fileExtname='["pdf", "png", "jpg", "zip", "rar", "doc", "docx", "xls", "xlsx"]'
							v-model="form.projectApprove.landPlanningPermitArr"
							@select="selectFile($event,'landPlanningPermit')"
							@delete="deleteFile($event,'landPlanningPermit')" limit="3" file-mediatype="all">
						</filePicker>
					</u-form-item>
				</view>
				<u-form-item required label="工程规划许可证状态:" prop="projectApprove.engineeringPlanningPermitStatus">
					<uni-data-select :clear="false" v-model="form.projectApprove.engineeringPlanningPermitStatus"
						:localdata="statusList"></uni-data-select>
				</u-form-item>
				<view v-if="form.projectApprove.engineeringPlanningPermitStatus==0">
					<u-form-item label="工程规划许可证号:">
						<uni-easyinput :clearSize="16" :maxlength="50" type="text" :inputBorder="true"
							v-model="form.projectApprove.engineeringPlanningPermitCode"
							placeholder="请输入工程规划许可证号"></uni-easyinput>
					</u-form-item>
					<u-form-item label="工程规划许可证附件:">
						<filePicker :fileExtname='["pdf", "png", "jpg", "zip", "rar", "doc", "docx", "xls", "xlsx"]'
							v-model="form.projectApprove.engineeringPlanningPermitArr"
							@select="selectFile($event,'engineeringPlanningPermit')"
							@delete="deleteFile($event,'engineeringPlanningPermit')" limit="3" file-mediatype="all">
						</filePicker>
					</u-form-item>
				</view>
				<u-form-item required label="审图合格证状态:" prop="projectApprove.drawingReviewCertificateStatus">
					<uni-data-select :clear="false" v-model="form.projectApprove.drawingReviewCertificateStatus"
						:localdata="statusList"></uni-data-select>
				</u-form-item>
				<view v-if="form.projectApprove.drawingReviewCertificateStatus==0">
					<u-form-item label="审图合格证号:">
						<uni-easyinput :clearSize="16" :maxlength="50" type="text" :inputBorder="true"
							v-model="form.projectApprove.drawingReviewCertificateCode"
							placeholder="请输入审图合格证号"></uni-easyinput>
					</u-form-item>
					<u-form-item label="审图合格证附件:">
						<filePicker :fileExtname='["pdf", "png", "jpg", "zip", "rar", "doc", "docx", "xls", "xlsx"]'
							v-model="form.projectApprove.drawingReviewCertificateArr"
							@select="selectFile($event,'drawingReviewCertificate')"
							@delete="deleteFile($event,'drawingReviewCertificate')" limit="3" file-mediatype="all">
						</filePicker>
					</u-form-item>
				</view>
				<u-form-item required label="施工许可证状态:" prop="projectApprove.constructionPermitStatus">
					<uni-data-select :clear="false" v-model="form.projectApprove.constructionPermitStatus"
						:localdata="statusList"></uni-data-select>
				</u-form-item>
				<view v-if="form.projectApprove.constructionPermitStatus==0">
					<u-form-item label="施工许可证号:">
						<uni-easyinput :clearSize="16" :maxlength="50" type="text" :inputBorder="true"
							v-model="form.projectApprove.constructionPermitCode"
							placeholder="请输入施工许可证号"></uni-easyinput>
					</u-form-item>
					<u-form-item label="施工许可证附件:">
						<filePicker :fileExtname='["pdf", "png", "jpg", "zip", "rar", "doc", "docx", "xls", "xlsx"]'
							v-model="form.projectApprove.constructionPermitArr"
							@select="selectFile($event,'constructionPermit')"
							@delete="deleteFile($event,'constructionPermit')" limit="3" file-mediatype="all">
						</filePicker>
					</u-form-item>
				</view>
			</view>
		</u--form>
		<pickDate ref="myPicker" @submit="handleSubmit" :start-year="1930" :end-year="2099"
			:time-hide="[true, true, true, false, false, false]" :time-label="['年', '月', '日']">
		</pickDate>
		<view style="padding: 40rpx 24rpx;">
			<u-button shape='circle' class="sub-btn" type="primary" @click="submit">提交</u-button>
		</view>
		<u-loading-page :loading="loading" bg-color="rgba(0, 0, 0, 0.3)"></u-loading-page>
	</view>
</template>

<script>
	import {
		subEdit,
		subAdd,
		getDicts,
		getProjectInfo
	} from '@/utils/api.js'
	import pickDate from '@/components/yt-dateTimePicker/yt-dateTimePicker.vue'
	import filePicker from '@/components/uni-file-picker/uni-file-picker.vue'
	export default {
		components: {
			filePicker,
			pickDate
		},
		data() {
			return {
				loading: false,
				dateType: "",
				dateList: [{
					name: '签约时间',
					label: 'signingDate'
				}, {
					name: '计划开工日期',
					label: 'plannedStartDate'
				}, {
					name: '供地时间',
					label: 'landSupplyDate'
				}, {
					name: '土地合同约定开工时间',
					label: 'agreedStart'
				}, {
					name: '土地合同约定竣工时间',
					label: 'agreedCompletion'
				}, {
					name: '监管协议约定达产时间',
					label: 'agreedProduction'
				}, {
					name: '列省市重大项目时间',
					label: 'majorProjectDate'
				}, {
					name: '第一张施工许可证日期',
					label: 'firstPermitDate'
				}, {
					name: '承诺制开工日期',
					label: 'promisedStartDate'
				}, {
					name: '实际开工日期',
					label: 'actualStartDate'
				}],
				form: {
					projectInfo: {},
					"projectApprove": {
						"projectDm": undefined,
						"recordedInvestmentAmount": undefined,
						"currentYearPlannedInvestment": undefined,
						"plannedStartDate": undefined,
						"landSupplyDate": undefined,
						"landSupplyArea": undefined,
						"street": undefined,
						"landLocationSecond": undefined,
						"agreedStart": undefined,
						"agreedCompletion": undefined,
						"agreedProduction": undefined,
						"majorProjectDate": undefined,
						"generalPlanDiagram": undefined,
						"projectProvince": undefined,
						"plannedConstructionArea": undefined,
						"firstPermitDate": undefined,
						"promisedStartDate": undefined,
						"actualStartDate": undefined,
						"commencedArea": undefined,
						"recordCertificate": undefined,
						"recordCertificateArr": [],
						"recordCertificateStatus": 1,
						"recordCertificateCode": undefined,
						"ownershipCertificateStatus": 1,
						"ownershipCertificateCode": undefined,
						"ownershipCertificate": undefined,
						"ownershipCertificateArr": [],
						"landPlanningPermitStatus": 1,
						"landPlanningPermitCode": undefined,
						"landPlanningPermit": undefined,
						"landPlanningPermitArr": [],
						"engineeringPlanningPermit": undefined,
						"engineeringPlanningArr": [],
						"engineeringPlanningPermitStatus": 1,
						"engineeringPlanningPermitCode": undefined,
						"drawingReviewCertificate": undefined,
						"drawingReviewCertificateArr": [],
						"drawingReviewCertificateStatus": 1,
						"drawingReviewCertificateCode": undefined,
						"constructionPermit": undefined,
						"constructionPermitArr": [],
						"constructionPermitStatus": 1,
						"constructionPermitCode": undefined,
						"evaluationApproval": undefined,
						"evaluationApprovalArr": [],
						"evaluationApprovalStatus": 1,
						"stabilityEvaluationApproval": undefined,
						"stabilityEvaluationApprovalArr": [],
						"stabilityEvaluationApprovalStatus": 1,
						"assessmentApprovalType": undefined,
						"assessmentApproval": undefined,
						"assessmentApprovalArr": [],
						"assessmentApprovalStatus": 1,
						"safetyApprovalType": undefined,
						"safetyApproval": undefined,
						"safetyApprovalArr": [],
						"safetyApprovalStatus": 1,
						"energyApprovalType": undefined,
						"energyApproval": undefined,
						"energyApprovalArr": [],
						"energyApprovalStatus": 1,
					},
					"projectBuild": {},
					projectCompletion: {},
					projectProduction: {},
					projectEfficiency: {}
				},
				rules: {
					'projectApprove.plannedStartDate': [{
						required: true,
						message: "计划开工日期不能为空",
						trigger: "change"
					}],
					'projectApprove.projectProvince': [{
						type: 'number',
						required: true,
						message: "省市重大项目不能为空",
						trigger: "change"
					}],
					'projectApprove.actualStartDate': [{
						required: true,
						message: "实际开工日期不能为空",
						trigger: "change"
					}]
				},
				projectId: null,
				statusList: [],
				hppslxList: [],
				appslxList: [],
				nppslxList: []
			};
		},
		onLoad(option) {
			this.projectId = option.id
			if (this.projectId) {
				getProjectInfo(option.id).then(res => {
					if (res.data.projectApprove) {
						this.form.projectApprove = res.data.projectApprove
					}
				})
			}
			this.init()
		},
		methods: {
			init() {
				//五评状态
				getDicts('wpblzt').then(response => {
					response.data.map(item => {
						item.text = item.dictLabel
						item.value = parseInt(item.dictValue)
					})
					this.statusList = response.data;
				})
				//环评类型
				getDicts('hppslx').then(response => {
					response.data.map(item => {
						item.text = item.dictLabel
						item.value = parseInt(item.dictValue)
					})
					this.hppslxList = response.data;
				})
				//安评类型
				getDicts('appslx').then(response => {
					response.data.map(item => {
						item.text = item.dictLabel
						item.value = parseInt(item.dictValue)
					})
					this.appslxList = response.data;
				})
				//能评类型
				getDicts('nppslx').then(response => {
					response.data.map(item => {
						item.text = item.dictLabel
						item.value = parseInt(item.dictValue)
					})
					this.nppslxList = response.data;
				})
			},
			//打开选择时间
			openDate(index) {
				this.dateType = index
				this.$refs.myPicker.show();
			},
			//选择时间
			handleSubmit(e) {
				if (this.dateType == 0) {
					this.form.projectInfo[this.dateList[this.dateType].label] = `${e.year}-${e.month}-${e.day}`
				} else {
					this.form.projectApprove[this.dateList[this.dateType].label] = `${e.year}-${e.month}-${e.day}`
				}
			},
			//选择上传
			selectFile(e, name) {
				uni.uploadFile({
					url: getApp().globalData.fileUrl, //仅为示例，非真实的接口地址
					filePath: e.tempFilePaths[0],
					name: 'file',
					header: {
						"Authorization": uni.getStorageSync('access_token'),
						"clientid": "e5cd7e4891bf95d1d19206ce24a7b32e"
					},
					success: (uploadFileRes) => {
						this.form.projectApprove[name + 'Arr'].push({
							name: JSON.parse(uploadFileRes.data).data.fileName,
							url: JSON.parse(uploadFileRes.data).data.url,
							ossId: JSON.parse(uploadFileRes.data).data.ossId
						})
						this.form.projectApprove[name] = this.form.projectApprove[name + 'Arr'].map((elem,
							index) => {
							return elem.ossId;
						}).join(",")
					},
					fail: (res) => {
						uni.showToast({
							title: res,
							icon: 'none'
						})
					}
				});
			},
			//删除上传
			deleteFile(e, name) {
				this.form.projectApprove[name + 'Arr'].splice(this.form.projectApprove[name + 'Arr'].findIndex(item => item
					.url == e.tempFilePath), 1);
				this.form.projectApprove[name] = this.form.projectApprove[name + 'Arr'].map((elem,
					index) => {
					return elem.ossId;
				}).join(",")
			},
			submit() {
				console.log('this.form: ', this.form);
				this.$refs.uForm.validate().then(res => {
					uni.showLoading({
						title: '提交中'
					});
					var subForm = {
						projectApprove: this.form.projectApprove
					}
					if (this.form.projectApprove.baseId) {
						subEdit(subForm).then(res => {
							if (res.code == 200) {
								uni.hideLoading()
								uni.showToast({
									title: '提交成功！',
									icon: 'success',
									duration: 2000
								})
								setTimeout(() => {
									uni.navigateBack()
								}, 2000)
							} else {
								uni.showToast({
									title: res.msg,
									icon: 'none',
									duration: 2000
								})
							}
						})
					} else {
						subAdd(this.projectId, subForm).then(res => {
							if (res.code == 200) {
								uni.hideLoading()
								uni.showToast({
									title: '提交成功！',
									icon: 'success',
									duration: 2000
								})
								setTimeout(() => {
									uni.navigateBack()
								}, 2000)
							} else {
								uni.showToast({
									title: res.msg,
									icon: 'none',
									duration: 2000
								})
							}
						})
					}
				}).catch(errors => {
					console.log('errors: ', errors);
					uni.$u.toast('请完善必填项！')
				})
			}
		},
		onReady() {
			//如果需要兼容微信小程序，并且校验规则中含有方法等，只能通过setRules方法设置规则。
			this.$refs.uForm.setRules(this.rules)
		}
	}
</script>

<style lang="scss" scoped>
	.form-area {
		background-color: #fff;
		margin-top: 30rpx;
		padding: 10rpx 30rpx 30rpx 30rpx;
	}
</style>